package book;

import java.util.Arrays;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: XMQ
 * Date: 2022-05-18
 * Time: 8:05
 */
//书架
public class Booklist {
    //最多放10本书
    private Book[] books = new Book[10];

    private int UseSize;//记录此时书架上有几本书

    public Booklist() {
        books[0] = new Book("三国演义","罗贯中","小说",99);
        books[1] = new Book("活着","余华","小说",101);
        books[2] = new Book("三体","刘慈欣","小说",78);
        UseSize = 3;
    }

    /**
     *
     * @param pos  pos是合法下标
     * @return  返回这个下标位置的书
     */
    public Book getBooks(int pos) {
        return books[pos];
    }

    /**
     *
     * @param pos  pos是合法下标
     * @param book  新增一本书
     */
    public void setBooks(int pos,Book book) {
        books[pos] = book;
    }

    /**
     *
     * @return  获取当前书架书的数量
     */
    public int getUseSize() {
        return UseSize;
    }

    /**
     *
     * @param useSize  改变书架书的数量
     */
    public void setUseSize(int useSize) {
        UseSize = useSize;
    }

}
